//提现
TIXIAN = {};

TIXIAN.is_load = false;

TIXIAN.__INIT__=function(){
    TIXIAN.fund_info();
}
TIXIAN.fund_info = function(){
	var url = url_('api/V4/fund_info');
	var data = {};
	var success = function(d){
		if (d.code == 0) {
			TIXIAN.data = d.data;
			TIXIAN.jump();
		} else{
			my_tips_(d.msg);
		}
	}
	request_(url,data,success)
}
TIXIAN.jump = function(){
	var context = TIXIAN.data;
	mainView.router.load({
        url: "src/my_center/tixian/tixian.html",
        context:context
    });
}

//提现操作
TIXIAN.apply_cash = function(){
	var money = Number($('#do_cash_val').val()); 
	var yue = Number($('#my_yue').html()); 
	if(money <= 0||money == 'NaN'){
		my_tips_('请输入有效的提现金额');
		return;
	}
	var content = $('#do_cash_memo').val();
	if(!content){
		content = '用户未填写申请原因';
	}
	var url = url_('api/V4/apply_cash');
	var data = {
		value: money,
		apply_memo: content
	};
	var success = function(d){
		if(d.code == 0){
			my_tips_('提现申请成功，后台为您处理后自动到账。',function(){
				go_href_('#/my_center')
			});
		}else{
			my_tips_(d.msg);
		}
	}
	request_(url,data,success);
}
//提现提示
TIXIAN.tixian_tips = function(t){
	var money = Number($(t).val());
	if(Math.floor(money*100)<money*100){
		$(t).val(Math.floor(money*100)/100);
	}
	var yue = Number($('#my_yue').html()); 
	if(money>yue){
		$('.tixian_tips_container').show();
	}else{
		$('.tixian_tips_container').hide();
	}
}
//全部提现
TIXIAN.tixian_all = function(){
	var money = $('#my_yue').html();
	$('#do_cash_val').val(money);
}